package Controllers;

import Models.LoginModel;
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import java.util.*;

public class LoginController extends HttpServlet {
    
    public void doPost( HttpServletRequest request, 
                      HttpServletResponse response) 
                      throws IOException, ServletException {

        String username = request.getParameter("username");
        String password = request.getParameter("password");

        // Now use our Coffee Model above 
        LoginModel model = new LoginModel();

       // Boolean result = model.CheckPassword(username, password);
        Boolean result =true;

        if(result){

            request.setAttribute("PasswordResult", result);
            RequestDispatcher view = request.getRequestDispatcher("main.jsp");
            view.forward(request, response); 

        }

        else{

            request.setAttribute("PasswordResult", result);
            RequestDispatcher view = request.getRequestDispatcher("index.jsp");
            view.forward(request, response); 
        }
    }
    
}
